package easy;

import java.util.ArrayList;
import java.util.List;

public class Solution_232 {

    public static void main(String[] args) {
        MyQueue obj = new MyQueue();
        obj.push(1);
        obj.push(2);
        int param_3 = obj.peek();
        int param_2 = obj.pop();
        boolean param_4 = obj.empty();
        System.out.println(param_2);
        System.out.println(param_3);
        System.out.println(param_4);
    }
}

class MyQueue {

    private Integer begin = -1;
    private Integer end = -1;
    private List<Integer> list;

    /** Initialize your data structure here. */
    public MyQueue() {
        list = new ArrayList<>();
    }

    /** Push element x to the back of queue. */
    public void push(int x) {
        list.add(x);
        end++;
    }

    /** Removes the element from in front of queue and returns that element. */
    public int pop() {
        if (begin==end) {
            return 0;
        }
        Integer val = list.get(begin+1);
        begin++;
        return val;
    }

    /** Get the front element. */
    public int peek() {
        if (begin==end) {
            return 0;
        }
        return list.get(begin+1);
    }

    /** Returns whether the queue is empty. */
    public boolean empty() {
        return begin == end;
    }
}
